<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body>div{
            width: 200px;
            border: 1px solid red;
            /*当元素的所有子元素全部浮动时,自动识别的高度为0
            后面的元素会顶上来并且有文本的话会把文本挤出去,导致显示异常
            通过overflow:hidden解决此问题*/
            overflow: hidden;
        }
        #d1{
            width: 50px;
            height: 50px;
            background-color: red;
            float: left;
        }
        #d2{
            width: 50px;
            height: 50px;
            background-color: green;
            float: left;
        }
        #d3{
            width: 50px;
            height: 50px;
            background-color: blue;
            float: left;
        }
        #d4{
            width: 300px;
            height: 200px;
            background-color: yellow;
        }
        ul{
            list-style-type: none;/*去掉图标*/
            margin: 0;
            padding: 0;
            /*解决高度识别为0 的问题*/
            overflow: hidden;
        }
        li{
            float: left;
            margin-right: 20px;
        }
    </style>
</head>
<body>
<ul>
    <li>首页</li>
    <li>免费课</li>
    <li>直播课</li>
    <li>精品课</li>
    <li>线上班</li>
    <li>线下班</li>
</ul>
<div>
    <div id="d1"></div>
    <div id="d2"></div>
    <div id="d3"></div>
</div>
<div id="d4">div4</div>

</body>
</html>